/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pqno;

import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.BasicGame;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.geom.Vector2f;

/**
 *
 * @author wida46984148
 */
public class Intermission1SlickBasicGame extends BasicGame {

    Entity plane = null;
    Entity land = null;
    Entity planeE = null;
    Entity planeE2 = null;
    Entity planeE3 = null;
    Entity planeE4 = null;
    Entity planeE5 = null;

    public Intermission1SlickBasicGame() {
        super("prueba 0.02");
    }

    @Override
    public void init(GameContainer gc)
            throws SlickException {
        land = new Entity("land");

        land.AddComponent(new ImageRenderComponent("PlaneRender", new Image("src/data/land.jpg")));

        plane = new Entity("plane");
        plane.AddComponent(new ImageRenderComponent("PlaneRender", new Image("src/data/plane.png")));
        plane.AddComponent(new TopDownMovement("PlaneMovement"));
        plane.setPosition(new Vector2f(400, 500));


        planeE = new Entity("planeE1");
        planeE.AddComponent(new ImageRenderComponent("planeERender1", new Image("src/data/plane2.png")));
        planeE.AddComponent(new DownEnemy("planeEMovement1"));
        planeE.setPosition(new Vector2f(100, -100));
//        planeE2 = new Entity("planeE2");
//        planeE2.AddComponent(new ImageRenderComponent("planeERender2", new Image("src/data/plane2.png")));
//        planeE2.AddComponent(new DownEnemy("planeEMovement2"));
//        planeE2.setPosition(new Vector2f(200, -200));
//        planeE3 = new Entity("planeE3");
//        planeE3.AddComponent(new ImageRenderComponent("planeERender3", new Image("src/data/plane2.png")));
//        planeE3.AddComponent(new DownEnemy("planeEMovement3"));
//        planeE3.setPosition(new Vector2f(300, -300));
//        planeE4 = new Entity("planeE4");
//        planeE4.AddComponent(new ImageRenderComponent("planeERender4", new Image("src/data/plane2.png")));
//        planeE4.AddComponent(new DownEnemy("planeEMovement4"));
//        planeE4.setPosition(new Vector2f(400, -400));
        planeE5 = new Entity("planeE5");
        planeE5.AddComponent(new ImageRenderComponent("planeERender5", new Image("src/data/plane2.png")));
        planeE5.AddComponent(new DownEnemy("planeEMovement5"));
        planeE5.setPosition(new Vector2f(500, -500));
    }

    @Override
    public void update(GameContainer gc, int delta)
            throws SlickException {
        land.update(gc, null, delta);
        plane.update(gc, null, delta);
        planeE.update(gc, null, delta);
//        planeE2.update(gc, null, delta);
//        planeE3.update(gc, null, delta);
//        planeE4.update(gc, null, delta);
        planeE5.update(gc, null, delta);
    }

    public void render(GameContainer gc, Graphics gr)
            throws SlickException {
        land.render(gc, null, gr);
        plane.render(gc, null, gr);
        planeE.render(gc, null, gr);
//        planeE2.render(gc, null, gr);
//        planeE3.render(gc, null, gr);
//        planeE4.render(gc, null, gr);
        planeE5.render(gc, null, gr);
    }

    public static void main(String[] args)
            throws SlickException {
        AppGameContainer app =
                new AppGameContainer(new Intermission1SlickBasicGame());

        app.setDisplayMode(800, 600, false);
        app.start();
    }
}
